package com.common.BearMethods;

import com.common.BearBean.ProductKpiBean;
import com.common.cons.Constans;
import com.common.retrofit.base.BaseMethods;
import com.common.utils.SortUtils;

import rx.Observable;
import rx.Subscriber;

public class ProductKpiQueryMethods extends BaseMethods {

    private static ProductKpiQueryMethods m_ins = null;

    public static ProductKpiQueryMethods getInstance() {
        if (m_ins == null) {
            synchronized (ProductKpiQueryMethods.class) {
                if (m_ins == null) {
                    m_ins = new ProductKpiQueryMethods();
                }
            }
        }
        return m_ins;
    }

    @Override
    protected String getHttpUrl() {
        return "api/Lists/";
    }

    private BearService initService() {
        return getRetrofit().create(BearService.class);
    }


    public void     goodKPI       (Subscriber<ProductKpiBean> subscriber,
                      String uid ,
                      String hashid,
                      String deptcode,
                      String begindate,
                      String enddate,
                      String typecode,
                      String statecode,
                      String years,
                      String season
    ) {
        String time  = System.currentTimeMillis()+"" ;
        Observable observable = initService().goodKPI (time,
                SortUtils.getMyHash("time"+time,"uid"+uid
                        ,"hashid"+hashid
                        ,"begindate"+begindate
                        ,"enddate"+enddate ,"deptcode"+deptcode,"typecode"+typecode,"statecode"+statecode,"years"+years,"season"+season
                ), Constans.ANDROID_APP_ID,"3",
              uid,hashid,deptcode,begindate,enddate,typecode,statecode,years,season
        );
        toSubscribe(observable, subscriber);
    }
}
